package com.job.structureType.facade;

/**
 * @Author 王博
 * @DateTime 2025-06-13 13:33
 */
public class ElectFacade {
    private Light light;
    private AirCondition airCondition;
    ElectFacade() {
        light = new Light();
        airCondition = new AirCondition();
    }

    public void listen(String msg) {
        if (msg.contains("打开")) {
            on();
        } else if (msg.contains("关闭")) {
            off();
        } else {
            System.out.println("您说的话我听不懂");
        }
    }

    private void on() {
        light.on();
        airCondition.on();
    }

    private void off() {
        light.off();
        airCondition.off();
    }
}
